]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
app-system: Don't show items with NoDisplay parents in the search
authorJasper St. Pierre <jstpierre@mecheye.net>
Tue, 19 Jun 2012 15:35:05 +0000 (11:35 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Thu, 21 Jun 2012 20:03:48 +0000 (16:03 -0400)
Additionally, require gnome-menus 3.5.3, as we're using new API
introduced there.

https://bugzilla.gnome.org/show_bug.cgi?id=658176

configure.ac
src/shell-app-system.c

index d59eab6263ce08073e6e7baf1c4ea69716d9d25e..06d856496fd510c4e79235514f637bfbeba40c37 100644 (file)
@@ -76,6 +76,7 @@ POLKIT_MIN_VERSION=0.100
 STARTUP_NOTIFICATION_MIN_VERSION=0.11
 GCR_MIN_VERSION=3.3.90
 GNOME_DESKTOP_REQUIRED_VERSION=3.5.1
+GNOME_MENUS_REQUIRED_VERSION=3.5.3
 
 AC_ARG_WITH(folks,
             AS_HELP_STRING([--with-folks],
@@ -100,7 +101,8 @@ PKG_CHECK_MODULES(GNOME_SHELL, gio-unix-2.0 >= $GIO_MIN_VERSION
                               $FOLKS_REQUIREMENT
                                libmutter >= $MUTTER_MIN_VERSION
                                gjs-internals-1.0 >= $GJS_MIN_VERSION
-                              libgnome-menu-3.0 $recorder_modules
+                              libgnome-menu-3.0 >= $GNOME_MENUS_REQUIRED_VERSION
+                               $recorder_modules
                                gdk-x11-3.0 libsoup-2.4
                                gl
                               clutter-x11-1.0 >= $CLUTTER_MIN_VERSION
index 621022094699abc7fff461df256c871e2047b0e6..7f34c28b60925333bf1d00afe5a1ab28ff44de95 100644 (file)
@@ -41,6 +41,7 @@ struct _ShellAppSystemPrivate {
   GMenuTree *apps_tree;
 
   GHashTable *running_apps;
+  GHashTable *visible_id_to_app;
   GHashTable *id_to_app;
 
   GSList *known_vendor_prefixes;
@@ -92,14 +93,16 @@ shell_app_system_init (ShellAppSystem *self)
   priv->id_to_app = g_hash_table_new_full (g_str_hash, g_str_equal,
                                            NULL,
                                            (GDestroyNotify)g_object_unref);
+
+  /* All the objects in this hash table are owned by id_to_app */
+  priv->visible_id_to_app = g_hash_table_new (g_str_hash, g_str_equal);
+
   priv->setting_id_to_app = g_hash_table_new_full (g_str_hash, g_str_equal,
                                                    NULL,
                                                    (GDestroyNotify)g_object_unref);
 
-  /* For now, we want to pick up Evince, Nautilus, etc.  We'll
-   * handle NODISPLAY semantics at a higher level or investigate them
-   * case by case.
-   */
+  /* We want to track NoDisplay apps, so we add INCLUDE_NODISPLAY. We'll
+   * filter NoDisplay apps out when showing them to the user. */
   priv->apps_tree = gmenu_tree_new ("applications.menu", GMENU_TREE_FLAGS_INCLUDE_NODISPLAY);
   g_signal_connect (priv->apps_tree, "changed", G_CALLBACK (on_apps_tree_changed_cb), self);
 
@@ -121,6 +124,7 @@ shell_app_system_finalize (GObject *object)
 
   g_hash_table_destroy (priv->running_apps);
   g_hash_table_destroy (priv->id_to_app);
+  g_hash_table_destroy (priv->visible_id_to_app);
   g_hash_table_destroy (priv->setting_id_to_app);
 
   g_slist_free_full (priv->known_vendor_prefixes, g_free);
@@ -308,6 +312,7 @@ on_apps_tree_changed_cb (GMenuTree *tree,
 
   g_assert (tree == self->priv->apps_tree);
 
+  g_hash_table_remove_all (self->priv->visible_id_to_app);
   g_slist_free_full (self->priv->known_vendor_prefixes, g_free);
   self->priv->known_vendor_prefixes = NULL;
 
@@ -369,6 +374,8 @@ on_apps_tree_changed_cb (GMenuTree *tree,
        * string is pointed to.
        */
       g_hash_table_replace (self->priv->id_to_app, (char*)id, app);
+      if (!gmenu_tree_entry_get_is_nodisplay_recurse (entry))
+        g_hash_table_replace (self->priv->visible_id_to_app, (char*)id, app);
 
       if (old_entry)
         gmenu_tree_item_unref (old_entry);
@@ -778,7 +785,7 @@ GSList *
 shell_app_system_initial_search (ShellAppSystem  *self,
                                  GSList          *terms)
 {
-  return search_tree (self, terms, self->priv->id_to_app);
+  return search_tree (self, terms, self->priv->visible_id_to_app);
 }
 
 /**